﻿using System;
using System.Collections.Generic;
using System.Text;
using ShootSearch.Runner.Controls;
using ShootSearch.Util.Serializers;
using System.IO;

namespace ShootSearch.Runner.Configurations
{
    public class TaskListConfig
    {
        public const string LIST_NAME = "List.xml";

        private static string path = RunnerHelper.TaskPath + LIST_NAME;
        
        public List<TaskItem> Tasks { get; set; }

        public TaskListConfig()
        {
            Tasks = new List<TaskItem>();
        }

        public void Save()
        {
            XmlFormatter.ToXmlFile(this, path);
        }

        public static TaskListConfig Load()
        {
            TaskListConfig tlc = XmlFormatter.FromFile(path, typeof(TaskListConfig)) as TaskListConfig;
            if (tlc == null)
            {
                tlc = new TaskListConfig();
                tlc.Save();
            }
            return tlc;
        }

    }

    public class TaskItem
    {
        public string Path { get; set; }

        public TaskItem() { }

        public TaskItem(string path) { this.Path = path; }
    }
}
